aboutsummaryrefslogtreecommitdiff
path: root/src/pages/[...path].tsx
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-10-22 22:51:50 +0300
committereug-vs <eugene@eug-vs.xyz>2022-10-22 22:51:50 +0300
commit0ed6bf41be126e8a4f274de06545dbf4f3f883c2 (patch)
tree879eab5d2faf28f42ed30bc012a90c58229b55b9 /src/pages/[...path].tsx
parent31b71bc0dc377b6a3f578188f2d3ee25cfe2e935 (diff)
downloadbenzin-next-0ed6bf41be126e8a4f274de06545dbf4f3f883c2.tar.gz
feat: support syntax highlighting
Diffstat (limited to 'src/pages/[...path].tsx')
-rw-r--r--src/pages/[...path].tsx6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pages/[...path].tsx b/src/pages/[...path].tsx
index 5bedae3..19dc42d 100644
--- a/src/pages/[...path].tsx
+++ b/src/pages/[...path].tsx
@@ -7,15 +7,18 @@ import Image from '../Image';
import emojiPlugin from '../emojiPlugin';
import remarkGemoji from 'remark-gemoji';
import benzinConfig from '../benzinConfig';
+import Code from '../Code';
const transformLinkUri = (uri: string): string => {
return uri.match(/(.*)\.md/)?.[1] || uri;
}
+/* Image sources are relative to CDN root */
const transformImageUri = (uri: string): string => {
return uri.startsWith('http') ? uri : benzinConfig.CDN + uri;
}
+/* Disable JavaScript in runtime */
export const config = {
unstable_runtimeJS: false,
};
@@ -27,7 +30,7 @@ export const getStaticProps = async (context: GetStaticPropsContext) => {
);
const markdownSource = await benzinConfig.adapter.getMarkdownSource(benzinConfig.CDN, path);
- const emojiFileNames = await benzinConfig.adapter.getEmojiFileNames(benzinConfig.CDN);
+ const emojiFileNames = await benzinConfig.adapter.getEmojiFileNames(benzinConfig.CDN, benzinConfig.emojiRootPath);
return {
props: {
@@ -63,6 +66,7 @@ const Page: NextPage = ({ markdownSource, emojiFileNames }: any) => {
components={{
emoji: Emoji,
img: Image,
+ code: Code,
h1: 'h2',
h2: 'h3',
h3: 'h4',